home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / APP / A-D / Alpha.4.01.cpt / LaTeX / Wright Macros / LaTeX-Macros < prev    next >
Text File  |  1991-10-17  |  6KB  |  266 lines

  1. ;=============TeX/LaTeX macros =================================
  2. ; This file implements some macros that I have found useful with
  3. ; LaTeX.
  4. ;                                David A. Wright
  5. ;                                (D.A.Wright@cs.utas.edu.au)
  6. ;                                Oct 17, 1991
  7. ; Please feel free to modify this file to suit your own purposes,
  8. ; but do please share any improvements with me!
  9. ; DISCLAIMER: I make no guarantee about the correctness of these 
  10. ; macros. They work for me under Alpha 4.0b2.
  11. ;===============================================================
  12.  
  13. ;===============================================================
  14. ; The following provide an easy way to type Greek and math in 
  15. ; LaTeX.
  16. (define alpha
  17.     type "\\alpha")
  18. (define beta
  19.     type "\\beta")
  20. (define delta
  21.     type "\\delta")
  22. (define epsilon
  23.     type "\\epsilon")
  24. (define phi
  25.     type "\\phi")
  26. (define gamma
  27.     type "\\gamma")
  28. (define eta
  29.     type "\\eta")
  30. (define kappa
  31.     type "\\kappa")
  32. (define lambda
  33.     type "\\lambda")
  34. (define mu
  35.     type "\\mu")
  36. (define nu
  37.     type "\\nu")
  38. (define omega
  39.     type "\\omega")
  40. (define pi
  41.     type "\\pi")
  42. (define theta
  43.     type "\\theta")
  44. (define rho
  45.     type "\\rho")
  46. (define sigma
  47.     type "\\sigma")
  48. (define tau
  49.     type "\\tau")
  50. (define upsilon
  51.     type "\\upsilon")
  52. (define chi
  53.     type "\\chi")
  54. (define psi
  55.     type "\\psi")
  56. (define zeta
  57.     type "\\zeta")
  58. (define Delta
  59.     type "\\Delta")
  60. (define Gamma
  61.     type "\\Gamma")
  62. (define Theta
  63.     type "\\Theta")
  64. (define Lambda
  65.     type "\\Lambda")
  66. (define Psi
  67.     type "\\Psi")
  68. (define Pi
  69.     type "\\Pi")
  70. (define Sigma
  71.     type "\\Sigma")
  72. (define Upsilon
  73.     type "\\Upsilon")
  74. (define Phi
  75.     type "\\Phi")
  76. (define Omega
  77.     type "\\Omega")
  78. (define leq
  79.     type "\\leq")
  80. (define geq
  81.     type "\\geq")
  82. (define tilde
  83.     type "\\tilde")
  84. (define infty
  85.     type "\\infty")
  86. (define forall
  87.     type "\\forall")
  88. (define exists
  89.     type "\\exists")
  90. (define not
  91.     type "\\not")
  92. (define in
  93.     type "\\in")
  94. (define times
  95.     type "\\times")
  96. (define subset
  97.     type "\\subset")
  98. (define supset
  99.     type "\\supset")
  100. (define subseteq
  101.     type "\\subseteq")
  102. (define supseteq
  103.     type "\\supseteq")
  104. (define setminus
  105.     type "\\setminus")
  106. (define cup
  107.     type "\\cup")
  108. (define cap
  109.     type "\\cap")
  110. (define langle
  111.     type "\\langle")
  112. (define rangle
  113.     type "\\rangle")
  114. (define hat
  115.     type "\\hat")
  116. (define vee
  117.     type "\\vee")
  118. (define emptyset
  119.     type "\\emptyset")
  120. (define cdot
  121.     type "\\cdot")
  122.  
  123. (bind 'a' <o> alpha)
  124. (bind 'b' <o> beta)
  125. (bind 'd' <o> delta)
  126. (bind 'e' <o> epsilon)
  127. (bind 'f' <o> phi)
  128. (bind 'g' <o> gamma)
  129. (bind 'h' <o> eta)
  130. (bind 'k' <o> kappa)
  131. (bind 'l' <o> lambda)
  132. (bind 'm' <o> mu)
  133. (bind '\2d' <o> nu)
  134. (bind 'o' <o> omega)
  135. (bind 'p' <o> pi)
  136. (bind 'q' <o> theta)
  137. (bind 'r' <o> rho)
  138. (bind 's' <o> sigma)
  139. (bind 't' <o> tau)
  140. (bind 'u' <o> upsilon)
  141. (bind 'x' <o> chi)
  142. (bind 'y' <o> psi)
  143. (bind 'z' <o> zeta) 
  144. (bind '\02' <so> Delta)
  145. (bind '\05' <so> Gamma)
  146. (bind '\11' <so> Theta)
  147. (bind '\25' <so> Lambda)
  148. (bind '\10' <so> Psi)
  149. (bind '\23' <so> Pi)
  150. (bind '\01' <so> Sigma)
  151. (bind '\20' <so> Upsilon)
  152. (bind '\09' <so> Phi)
  153. (bind '\1f' <so> Omega)
  154. (bind ',' <o> leq)
  155. (bind '.' <o> geq)
  156. (bind '~' <o> tilde)
  157. (bind 'I' <o> infty)
  158. (bind 'A' <o> forall)
  159. (bind 'E' <o> exists)
  160. (bind '!' <o> not)
  161. (bind 'i' <o> in)
  162. (bind '*' <o> times)
  163. (bind '{' <o> subset)
  164. (bind '}' <o> supset)
  165. (bind '[' <o> subseteq)
  166. (bind ']' <o> supseteq)
  167. (bind '/' <o> setminus)
  168. (bind '+' <o> cup)
  169. (bind '-' <o> cap)
  170. (bind '(' <o> langle)
  171. (bind ')' <o> rangle)
  172. (bind '^' <o> hat)
  173. (bind 'v' <o> vee)
  174. (bind '0' <o> emptyset)
  175. (bind '.' <o> cdot)
  176.  
  177. ;================================================================
  178. ; Misc. useful macros.
  179.  
  180. (define timeStamp
  181.     mark "current"
  182.     beginningOfBuffer
  183.     killLine
  184.     type "%% Last entered at "
  185.     acmd "Paste Time"
  186.     type " on "
  187.     acmd "Paste Date"
  188.     goto "current"
  189. )
  190.  
  191. (define texComment
  192.     set prefixString "%% "
  193.     insertPrefix)
  194.  
  195. (define texUncomment
  196.     set prefixString "%% "
  197.     removePrefix)
  198.  
  199. (define texScopeRegion
  200.     markHilite
  201.     type "{"
  202.     exchangePointAndMark
  203.     type "}"
  204.     exchangePointAndMark)
  205.  
  206. (define texMathRegion
  207.     markHilite
  208.     type "$"
  209.     exchangePointAndMark
  210.     type "$"
  211.     exchangePointAndMark)
  212.  
  213. (define texInsertBraces
  214.     type "{}"
  215.     backwardChar)
  216.  
  217. (define texStartMath
  218.     type "$$"
  219.     backwardChar)
  220.  
  221. (define texCloseLaTeXBlock                                            
  222.     beginningOfLine                                                       
  223.     forwardWord                                                       
  224.     forwardChar                                                         
  225.     setMark                                                             
  226.     forwardWord                                                              
  227.     copy                                                                   
  228.     endOfLine                                                            
  229.     2 carriageReturn                                                    
  230.     type "\\end{"                                                         
  231.     paste                                                                    
  232.     type "}"                                                                
  233.     previousLine                                                             
  234.     doTab)                                                                   
  235.  
  236. (define nextSection                
  237.     saveVars
  238.     set regExpr on
  239.     set forward on
  240.     forwardChar
  241.     search "\\(sub)?section"
  242.     setMark
  243.     endOfLine
  244.     markHilite
  245.     restoreVars)
  246.  
  247. (define prevSection                
  248.     saveVars
  249.     set regExpr on
  250.     set forward off
  251.     setMark                    ; unhilites text if currently hilited
  252.     backwardChar
  253.     search "\\(sub)?section"
  254.     setMark
  255.     endOfLine
  256.     markHilite
  257.     restoreVars)
  258.  
  259. (bind '\15'    <s>    texStartMath)
  260. (bind 'w'    <o>    texCloseLaTeXBlock)
  261. (bind '{'    <s> texInsertBraces)
  262.  
  263. (bind '\79'        nextSection)
  264. (bind '\74'      prevSection)
  265.  
  266.